

#include <iostream>
#include <string>
#include <cstring>
#include <cassert>
#include <vector>
#include <sys/epoll.h>
#include <functional>
#include <unordered_map>
#include <sys/eventfd.h>
#include <memory>
#include <functional>
#include <thread>
#include <typeinfo>
#include <mutex>
#include <ctime>
#include <sys/timerfd.h>
#include <sys/select.h>
#include <map>


using F = std::function<void()>;
class Add
{
    public:
    Add(F f):_f(f)
    {
    }

    ~Add()
    {
        _f();
    }
private :
    F _f;
};

using WeatPtr = std::weak_ptr<Add>;
using TaskPtr = std::shared_ptr<Add>;
std::map<int,WeatPtr> mp;

void Eease()
{
    auto it = mp.find(1);
    std::cout<<it->second.lock() <<std::endl;
}

int main()
{
  
    std::vector<TaskPtr> v;
    {
        auto tmp = std::make_shared<Add>(&Eease);
        v.push_back(tmp);
        mp[1] = WeatPtr(tmp);
    }

    v.clear();

    return 0;
}